package com.dhl.cloud.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dhl.cloud.common.http.HttpResult;
import com.dhl.cloud.common.http.HttpUser;
import com.dhl.cloud.common.vdo.UserInfoBean;
import com.dhl.cloud.core.service.UserService;

@RestController
@RequestMapping(value = "/user")
public class UserController extends BaseController{

	@Autowired
	private UserService userService;

    /**
     * 获取我的信息
     * @return 返回用户的用户名、签名、证件号、手机等信息
     */
    @GetMapping("getMyInfo")
    public HttpResult getMyInfo(HttpServletRequest request)
    {
        HttpUser user = getUser(request);
        String username = user.getUsername();
        String tenantid = user.getTenantid();

        //后面需要修订用户的机构、专业信息
        UserInfoBean ub = userService.getMyInfo(username,tenantid);
        return HttpResult.success("",ub);
    }
}
